package cn.xzqwjw.taskmanager.domain.pojo;

import cn.xzqwjw.taskmanager.common.validator.ValidGroupUpdate;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @author rush
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class SysFrontRoute extends Model<SysFrontRoute> implements Serializable {

  @TableField(exist = false)
  private static final long serialVersionUID = 1L;

  @Override
  public Serializable pkVal() {
    return this.id;
  }

  @TableId(value = "id", type = IdType.AUTO)
  @NotNull(message = "id不能为空", groups = ValidGroupUpdate.class)
  private Integer id;

  /**
   * 上级菜单id
   */
  private Integer idParent;

  /**
   * 级别
   */
  private Integer level;

  /**
   * 页面路径
   */
  @Length(max = 255, message = "最多{max}个字符")
  private String clientUrl;

  /**
   * vue-router里的名称（英文）
   */
  @Length(max = 50, message = "最多{max}个字符")
  private String routeName;

  /**
   * 页面组件路径
   */
  @Length(max = 200, message = "最多{max}个字符")
  private String componentPath;

  /**
   * 重定向地址
   */
  @Length(max = 100, message = "最多{max}个字符")
  private String redirect;

  /**
   * 菜单显示名称（中文）
   */
  @Length(max = 50, message = "最多{max}个字符")
  private String title;

  /**
   * 菜单上显示的图标
   */
  @Length(max = 50, message = "最多{max}个字符")
  private String icon;

  /**
   * 是否总是在左侧导航栏显示
   */
  private Boolean flagShowLeft;

  /**
   * 是否隐藏，不在左侧主导航栏显示
   */
  private Boolean flagHidden;

  /**
   * 排序
   */
  private Integer weight;

  /**
   * 子路由
   */
  @TableField(exist = false)
  private List<SysFrontRoute> childRouterList;

}
